﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using IMPlant.Core.Data.Unity;
using SMTC.Model.TestCore;
using System.Data;

namespace SMTC.Dao.AddEmployee
{
   public class AddEmployeeDao:BaseDao 

    {
        #region SQL语句
        /// <summary>
        /// 获取新增用户信息
        /// </summary>
       private const string SQL_SENECT_Employee = @"select EMPNbr,Name,Mtel,Tel,Fax,EMail,DeptID,Post,other from EmpInfo";
        private const string SQL_INSERT_Employee = @"insert into EmpInfo(EMPNbr,Name,Mtel,Tel,Fax,EMail,DeptID,Post,other)
                                                  values(@EMPNbr,@Name,@Mtel,@Tel,@Fax,@EMai,@DeptID,@Post,@other)";
        #endregion

        public List<EmpInfo> AdduserGridAddEmployeeGridViewBind()
        {
            List<EmpInfo> employeelist = DBTemplete.ExcuteGetList<EmpInfo>(CommandType.Text, SQL_SENECT_Employee);
            return employeelist;
        }
        /// <summary>
        /// 验证用户是否存在-name，psw
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="passWord">密码</param>
        /// <returns>如果存在返回true，否则返回false</returns>
        public void InsertEmployee(string  EMPNbr, string Name, string Mtel, string Tel, string Fax, string EMail, int DeptID, string Post, string other)
        {
            DbParameter[] parameter =
            {
                DBparameterBuild.Build("@EMPNbr",EMPNbr)
               ,DBparameterBuild.Build("@Name",Name)
               ,DBparameterBuild.Build("@Mtel",Mtel)
               ,DBparameterBuild.Build("@Tel",Tel)
               ,DBparameterBuild.Build("@Fax",Fax)
               ,DBparameterBuild.Build("@EMai",EMail)
               ,DBparameterBuild.Build("@DeptID",DeptID)
               ,DBparameterBuild.Build("@Post",Post)
               ,DBparameterBuild.Build("@other",other)
             };

            try
            {
                int result = DBTemplete.ExcuteNoQuery(System.Data.CommandType.Text, SQL_INSERT_Employee, parameter);


            }
            catch (Exception ex)
            {

            }

        }
    }
}
